<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let a = 10;
      function foo(a) {
        return function (b) {
          console.log(b + ++a);
        };
      }

      let fn = foo(10);
      fn(5);
      foo(6)(7);
      fn(20);
      console.log(a);

      fn = null;
      foo = null;
    </script>
  </body>
</html>
